package com.tommy.ddp.grid
{
	import com.tommy.ddp.GridDataManager;
	import com.tommy.ddp.definition.DDPConfig;
	
	import starling.display.Quad;
	import starling.display.Sprite;

	/**
	 * 对对碰背景格子
	 * @author tommy
	 * 
	 */	
	public class DdpGrid extends Sprite
	{
		private var img:Quad;
		private var _row:int;
		private var _column:int;
		
		public function DdpGrid()
		{
			img = new Quad(DDPConfig.GRID_W,DDPConfig.GRID_H);
			img.color = 0;
			img.alpha = 0.5;
			addChild(img);
		}
		/**
		 * 第几行/Y
		 * @param v
		 * 
		 */		
		public function set row(v:uint):void
		{
			_row = v;
			this.y = _row*DDPConfig.GRID_H;
		}
		/**
		 * 第几列/X
		 * @param v
		 * 
		 */		
		public function set column(v:uint):void
		{
			_column = v;
			this.x = _column*DDPConfig.GRID_W;
		}
		
		/**
		 * 当前格子是否可用来填放棋子
		 * @return 
		 * 
		 */		
		public function get isAvaliable():Boolean
		{
			return true;// && GridDataManager.getBox(_column,_row) == null;
		}
	}
}